package com.bytedance.common.databinding;

import android.os.Build;
import android.util.SparseArray;

import java.util.ArrayDeque;
import java.util.List;

final class z implements Runnable {
    private final DataBinding a;

    z(DataBinding arg1) {
        this.a = arg1;

    }

    public final void run() {
        ArrayDeque v1_1;
        Object[] v5;
        synchronized (this) {
            DataBinding.b(this.a);
        }

        if (Build.VERSION.SDK_INT < 19 || (DataBinding.c(this.a).isAttachedToWindow())) {
            DataBinding v4 = this.a;
            if (v4.g) {
                v4.d();
            } else if (v4.b()) {
                v4.g = true;
                v4.d = false;
                synchronized (v4) {
                    v5 = v4.b.toArray();
                    v4.b.clear();
                }

                int v6 = v5.length;
                int v2;
                for (v2 = 0; v2 < v6; ++v2) {
                    Object v0_1 = v5[v2];
                    if ((v0_1 instanceof DataBinding.c)) {
                        Object v1 = v4.f.get(((DataBinding.c) v0_1).a);
                        if (v1 != null) {
                            v1 = ((SparseArray) v1).get(((DataBinding.c) v0_1).b);
                            if (v1 != null) {
                                DataBinding.a(((List) v1));
                            }
                        }

                        v1_1 = v4.h;
                        synchronized (v1_1) {
                            v4.h.offer(v0_1);
                        }
                    } else {
                        DataBinding.a(v4.e.get(v0_1));
                    }
                }

                v4.g = false;
                return;
            }
        } else {
            DataBinding.c(this.a).removeOnAttachStateChangeListener(DataBinding.e());
            DataBinding.c(this.a).addOnAttachStateChangeListener(DataBinding.e());
        }
    }
}

